<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@ page import="java.sql.*;"%>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%
	String name = request.getParameter("bookname");
	try {
		Class.forName("com.mysql.jdbc.Driver");
	} catch (ClassNotFoundException e) {
		out.print(e);
	}

	Connection con;
	Statement sql;

	String url = "jdbc:mysql://localhost:3306/bookinfo?useUnicode=true&amp;characterEncoding=UTF-8&amp;zeroDateTimeBehavior=convertToNull";
	String user = "root";
	String psword = "chuichuiqqt";

	if ( name.equals("")) {
%>
		<div class="jumbotron">
    		<h3>书名不能为空~！</h3>
    	</div>
<%
	} else {
		try { 
			con=DriverManager.getConnection(url,user,psword);
	        sql=con.createStatement();
		    sql.execute("delete from book where name='" + name + "'");
%>
	    	<div class="jumbotron">
	    		<h3>删除书名为 《<%=name%>》 的书籍成功～！</h3>
	    	</div>
<%
		} catch (SQLException e) {
			out.print(e);
%>
			<div class="jumbotron">
	    		<h3>删除书名为 《<%=name%>》 的书籍失败～！</h3>
	    	</div>
<%
		}
	}
%>